

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>iSCSI Initiator for Linux &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="iSCSI Initiator for Microsoft Windows" href="../iscsi-initiator-win/" />
    <link rel="prev" title="iSCSI Initiators 的配置" href="../iscsi-initiators/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 块设备</a></li>
          <li class="breadcrumb-item"><a href="../rbd-integrations/">Ceph 块设备与第三方对接</a></li>
          <li class="breadcrumb-item"><a href="../iscsi-overview/">Ceph iSCSI Gateway</a></li>
          <li class="breadcrumb-item"><a href="../iscsi-initiators/">iSCSI Initiators 的配置</a></li>
      <li class="breadcrumb-item active">iSCSI Initiator for Linux</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/rbd/iscsi-initiator-linux.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 块设备</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../rados-rbd-cmds/">基本命令</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rbd-operations/">运维</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../rbd-integrations/">对接</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../rbd-ko/">内核模块</a></li>
<li class="toctree-l3"><a class="reference internal" href="../qemu-rbd/">QEMU</a></li>
<li class="toctree-l3"><a class="reference internal" href="../libvirt/">libvirt</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-kubernetes/">Kubernetes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-nomad/">Nomad</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-openstack/">OpenStack</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-cloudstack/">CloudStack</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../iscsi-overview/">LIO iSCSI Gateway</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../iscsi-requirements/">Requirements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../iscsi-targets/">Configuring the iSCSI Target</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="../iscsi-initiators/">Configuring the iSCSI Initiators</a></li>
<li class="toctree-l4"><a class="reference internal" href="../iscsi-monitoring/">Monitoring the iSCSI Gateways</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../rbd-windows/">Windows</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nvmeof-overview/">NVMe-oF 网关</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../man/">手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="iscsi-initiator-for-linux">
<h1>iSCSI Initiator for Linux<a class="headerlink" href="#iscsi-initiator-for-linux" title="Permalink to this heading"></a></h1>
<p><strong>Prerequisite:</strong></p>
<ul class="simple">
<li><p>Package <code class="docutils literal notranslate"><span class="pre">iscsi-initiator-utils</span></code></p></li>
<li><p>Package <code class="docutils literal notranslate"><span class="pre">device-mapper-multipath</span></code></p></li>
</ul>
<p><strong>Installing:</strong></p>
<p>Install the iSCSI initiator and multipath tools:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">yum<span class="w"> </span>install<span class="w"> </span>iscsi-initiator-utils</span>
<span class="prompt1">yum<span class="w"> </span>install<span class="w"> </span>device-mapper-multipath</span>
</pre></div></div><p><strong>Configuring:</strong></p>
<ol class="arabic">
<li><p>Create the default <code class="docutils literal notranslate"><span class="pre">/etc/multipath.conf</span></code> file and enable the
<code class="docutils literal notranslate"><span class="pre">multipathd</span></code> service:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">mpathconf<span class="w"> </span>--enable<span class="w"> </span>--with_multipathd<span class="w"> </span>y</span>
</pre></div></div></li>
<li><p>Add the following to the <code class="docutils literal notranslate"><span class="pre">/etc/multipath.conf</span></code> file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">devices</span> <span class="p">{</span>
        <span class="n">device</span> <span class="p">{</span>
                <span class="n">vendor</span>                 <span class="s2">&quot;LIO-ORG&quot;</span>
                <span class="n">product</span>                <span class="s2">&quot;TCMU device&quot;</span>
                <span class="n">hardware_handler</span>       <span class="s2">&quot;1 alua&quot;</span>
                <span class="n">path_grouping_policy</span>   <span class="s2">&quot;failover&quot;</span>
                <span class="n">path_selector</span>          <span class="s2">&quot;queue-length 0&quot;</span>
                <span class="n">failback</span>               <span class="mi">60</span>
                <span class="n">path_checker</span>           <span class="n">tur</span>
                <span class="n">prio</span>                   <span class="n">alua</span>
                <span class="n">prio_args</span>              <span class="n">exclusive_pref_bit</span>
                <span class="n">fast_io_fail_tmo</span>       <span class="mi">25</span>
                <span class="n">no_path_retry</span>          <span class="n">queue</span>
        <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</li>
<li><p>Restart the <code class="docutils literal notranslate"><span class="pre">multipathd</span></code> service:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>reload<span class="w"> </span>multipathd</span>
</pre></div></div></li>
</ol>
<p><strong>iSCSI Discovery and Setup:</strong></p>
<ol class="arabic">
<li><p>Enable CHAP authentication and provide the initiator CHAP username
and password by uncommenting and setting the following options in
the <code class="docutils literal notranslate"><span class="pre">/etc/iscsi/iscsid.conf</span></code> file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">node</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">auth</span><span class="o">.</span><span class="n">authmethod</span> <span class="o">=</span> <span class="n">CHAP</span>
<span class="n">node</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">auth</span><span class="o">.</span><span class="n">username</span> <span class="o">=</span> <span class="n">myusername</span>
<span class="n">node</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">auth</span><span class="o">.</span><span class="n">password</span> <span class="o">=</span> <span class="n">mypassword</span>
</pre></div>
</div>
<p>If you intend to use mutual (bidirectional) authentication, provide the
target CHAP username and password:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">node</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">auth</span><span class="o">.</span><span class="n">username_in</span> <span class="o">=</span> <span class="n">mytgtusername</span>
<span class="n">node</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">auth</span><span class="o">.</span><span class="n">password_in</span> <span class="o">=</span> <span class="n">mytgtpassword</span>
</pre></div>
</div>
</li>
<li><p>Discover the target portals:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">iscsiadm<span class="w"> </span>-m<span class="w"> </span>discovery<span class="w"> </span>-t<span class="w"> </span>st<span class="w"> </span>-p<span class="w"> </span><span class="m">192</span>.168.56.101</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mf">192.168.56.101</span><span class="p">:</span><span class="mi">3260</span><span class="p">,</span><span class="mi">1</span> <span class="n">iqn</span><span class="mf">.2003</span><span class="o">-</span><span class="mf">01.</span><span class="n">org</span><span class="o">.</span><span class="n">linux</span><span class="o">-</span><span class="n">iscsi</span><span class="o">.</span><span class="n">rheln1</span>
<span class="mf">192.168.56.102</span><span class="p">:</span><span class="mi">3260</span><span class="p">,</span><span class="mi">2</span> <span class="n">iqn</span><span class="mf">.2003</span><span class="o">-</span><span class="mf">01.</span><span class="n">org</span><span class="o">.</span><span class="n">linux</span><span class="o">-</span><span class="n">iscsi</span><span class="o">.</span><span class="n">rheln1</span>
</pre></div>
</div>
</li>
<li><p>Log in to the target:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">iscsiadm<span class="w"> </span>-m<span class="w"> </span>node<span class="w"> </span>-T<span class="w"> </span>iqn.2003-01.org.linux-iscsi.rheln1<span class="w"> </span>-l</span>
</pre></div></div></li>
</ol>
<p><strong>Multipath IO Setup:</strong></p>
<ol class="arabic">
<li><p>The multipath daemon (<code class="docutils literal notranslate"><span class="pre">multipathd</span></code>) uses the <code class="docutils literal notranslate"><span class="pre">multipath.conf</span></code> settings
to set up devices automatically. Running the <code class="docutils literal notranslate"><span class="pre">multipath</span></code> command shows
that the devices have been set up in a failover configuration. Notice that
each path has been placed into its own priority group:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">multipath<span class="w"> </span>-ll</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span>mpathbt (360014059ca317516a69465c883a29603) dm-1 LIO-ORG ,IBLOCK
size=1.0G features=&#39;0&#39; hwhandler=&#39;1 alua&#39; wp=rw
|-+- policy=&#39;queue-length 0&#39; prio=50 status=active
| `- 28:0:0:1 sde  8:64  active ready running
`-+- policy=&#39;queue-length 0&#39; prio=10 status=enabled
  `- 29:0:0:1 sdc  8:32  active ready running
</pre></div>
</div>
<p>You should now be able to use the RBD image in the same way that you would
use a normal multipath iSCSI disk.</p>
</li>
<li><p>Log out of the target:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">iscsiadm<span class="w"> </span>-m<span class="w"> </span>node<span class="w"> </span>-T<span class="w"> </span>iqn.2003-01.org.linux-iscsi.rheln1<span class="w"> </span>-u</span>
</pre></div></div></li>
</ol>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../iscsi-initiators/" class="btn btn-neutral float-left" title="iSCSI Initiators 的配置" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../iscsi-initiator-win/" class="btn btn-neutral float-right" title="iSCSI Initiator for Microsoft Windows" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>